package concept.chapter7.writtinggenericmethods;

import java.util.LinkedList;
import java.util.List;

public abstract class BackLister
{
	public abstract <T> List<T> backwards1(List<T> input);
	public <T> List<T> backwards1_1(List<? extends T> input)
	{
		List<T> output = new LinkedList<T>();
		for(T t:input)
		{
			output.add(0, t);
		}
		return output;
	}
	
	public <T> List<T> backwards1_2(List<T> input)
	{
		List<T> output = new LinkedList<T>();
		for(T t:input)
		{
			output.add(0, t);
		}
		return output;
	}
	
	public <T> List<? extends T> backwards2(List<T> input)
	{
		List<T> output = new LinkedList<T>();
		
		for(T t:input)
		{
			output.add(0, t);
		}
		return output;
	}
	
	public <T> List<? super T> backwards3(List<T> input)
	{
		List<T> output = new LinkedList<T>();
		
		for(T t:input)
		{
			output.add(0, t);
		}
		return output;
	}
	
	public <S extends CharSequence> S foo(S s)
	{
		//return s.toString();
		return (S)new StringBuilder(s);
		
	}
}
